home *** CD-ROM | disk | FTP | other *** search
- on pInitTyping
- global goTyping
- if objectp(goTyping) then
- goTyping(mdispose)
- end if
- set goTyping to fTyping(mnew)
- when keyDown then goTyping(mHitKey)
- end
-
- on pStopTyping
- global goTyping
- repeat with x = 4 to 14
- if the puppet of sprite x = 1 then
- set the visible of sprite x to 0
- puppetSprite(x, 0)
- set the visible of sprite x to 1
- end if
- end repeat
- if objectp(goTyping) then
- goTyping(mSetPuppets, 0)
- goTyping(mdispose)
- end if
- set the keyDownScript to "QuitKeyDown"
- end
-
- on ShowTheName
- global theNameSprite
- set the visible of sprite theNameSprite to 1
- end
-
- on HideTheName
- global theNameSprite
- set the visible of sprite theNameSprite to 0
- end
-
- on Page0StopAllSound
- global QTspriteNum
- if the visible of sprite QTspriteNum = 1 then
- set the movieRate of sprite QTspriteNum to 0
- set the movieTime of sprite QTspriteNum to 0
- set the visible of sprite QTspriteNum to 0
- end if
- puppetSound(0)
- updateStage()
- end
-
- factory fTyping
- method mnew
- instance exitFrame, gCategoryNum, gFromIndexFlag, ichFirstLetter, iMaxLetters, iNameString, iLetterNumber, iLowerLetters, iLetters, iLetterHit, iNextH
- global gPlaceHolder
- set iMaxLetters to 9
- set ichFirstLetter to 4
- set iLetterNumber to 1
- set iNameString to " "
- set iLowerLetters to "abcdefghijklmnopqrstuvwxyz"
- set iLetters to "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-'. "
- set iNextH to the left of sprite ichFirstLetter
- me(mSetPuppets, 1)
-
- method mSetPuppets trueOrFalse
- repeat with i = ichFirstLetter to ichFirstLetter + iMaxLetters - 1
- puppetSprite(i, trueOrFalse)
- set the stretch of sprite i to 0
- end repeat
-
- method mHitKey
- global gLastKey
- if (the key = RETURN) or ((the key = ENTER) and (iLetterNumber > 1)) then
- placeName()
- exit
- end if
- if the commandDown or the controlDown or the optionDown then
- set the exitLock to 1
- if the machineType = 256 then
- if the controlDown and (the key = "Q") then
- set gQuitReturn to the movieName
- go(1, "Quit.dir")
- end if
- else
- if the commandDown and ((the key = "Q") or (the key = ".")) then
- set gQuitReturn to the movieName
- go(1, "Quit.dir")
- end if
- end if
- exit
- end if
- set iLetterHit to the key
- if iLetterHit = BACKSPACE then
- set gLastKey to " "
- if iLetterNumber = 1 then
- beep()
- else
- set iLetterNumber to iLetterNumber - 1
- set gLastKey to char iLetterNumber - 1 of iNameString
- put " " into char iLetterNumber of iNameString
- me(mDrawAll)
- end if
- else
- if iLetterNumber > iMaxLetters then
- beep()
- exit
- end if
- set theLetterOffset to 0
- set theLetterOffset to offset(iLetterHit, iLowerLetters)
- if theLetterOffset <> 0 then
- set iLetterHit to chars(iLetters, theLetterOffset, theLetterOffset)
- else
- set theLetterOffset to offset(iLetterHit, iLetters)
- end if
- if theLetterOffset = 0 then
- beep()
- exit
- end if
- set gLastKey to iLetterHit
- put iLetterHit into char iLetterNumber of iNameString
- me(mDraw)
- set iLetterNumber to iLetterNumber + 1
- dontPassEvent()
- end if
-
- method mDraw
- global gPlaceHolder
- set theChannel to ichFirstLetter + iLetterNumber - 1
- set theLetter to char iLetterNumber of iNameString
- set theLetterOffset to offset(theLetter, iLetters)
- set theNewCast to the number of cast "FirstLetter" + theLetterOffset - 1
- set the castNum of sprite theChannel to theNewCast
- set the locH of sprite theChannel to iNextH
- updateStage()
- set iNextH to iNextH + (the right of sprite theChannel - the left of sprite theChannel)
- set gPlaceHolder to iNextH
-
- method mDrawAll
- global gFullName, gPlaceHolder
- set iNextH to the left of sprite ichFirstLetter
- repeat with i = 1 to iMaxLetters
- set theChannel to ichFirstLetter + i - 1
- set theLetter to char i of iNameString
- set theLetterOffset to offset(theLetter, iLetters)
- set theNewCast to the number of cast "FirstLetter" + theLetterOffset - 1
- set the castNum of sprite theChannel to theNewCast
- set the locH of sprite theChannel to iNextH
- if i < iLetterNumber then
- set iNextH to iNextH + (the right of sprite theChannel - the left of sprite theChannel)
- end if
- end repeat
- updateStage()
- set gPlaceHolder to iNextH
- set gFullName to iNameString
-
- method mPronounceLetter
- set castNameToPlay to iLetterHit
- if castNameToPlay = "'" then
- set castNameToPlay to "Apostrophe"
- else
- if castNameToPlay = " " then
- set castNameToPlay to "Space"
- else
- if castNameToPlay = "-" then
- set castNameToPlay to "Hyphen"
- else
- if castNameToPlay = "." then
- set castNameToPlay to "Period"
- end if
- end if
- end if
- end if
- pPlayMySound(castNameToPlay)
-